package com.primestone.cim.dashboardforcim.domain;

// Generated Mar 7, 2013 12:23:19 AM by Hibernate Tools 4.0.0

import static javax.persistence.GenerationType.IDENTITY;

import java.sql.Clob;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

/**
 * ResMeterReadings generated by hbm2java
 */
@Entity
@Table(name = "RES_METER_READINGS", schema = "PUBLIC", catalog = "TMPTABLES")
@NamedQueries({
		@NamedQuery(name = "ResMeterReadings.findByTicket", query = "select o from ResMeterReadings o where o.ticket = :ResMeterReadings_ticket"),
		@NamedQuery(name = "ResMeterReadings.deleteById", query = "delete from ResMeterReadings where id = :ResMeterReadings_id"),
		@NamedQuery(name = "ResMeterReadings.countByUser", query = "select o.username, count(o.id) from ResMeterReadings o group by o.username") })
@NamedNativeQueries({
		@NamedNativeQuery(name = "ResMeterReadings.findFirstByTicket", query = "select o.* from res_meter_readings o where o.ticket = ? and rownum() = 1 order by o.id", resultClass = ResMeterReadings.class),
		@NamedNativeQuery(name = "ResMeterReadings.findNextByTicket", query = "select o.* from res_meter_readings o where o.ticket = ? and o.id > ? and rownum() = 1 order by o.id", resultClass = ResMeterReadings.class) })
public class ResMeterReadings implements java.io.Serializable {

	private static final long serialVersionUID = -9111353379190762479L;
	private Long id;
	private String ticket;
	private String username;
	private Date jsonResultDate;
	private Clob jsonResults;

	/**
	 * 
	 */
	public ResMeterReadings() {
	}

	/**
	 * @param ticket
	 * @param username
	 * @param jsonResultDate
	 * @param jsonResults
	 */
	public ResMeterReadings(String ticket, String username,
			Date jsonResultDate, Clob jsonResults) {
		this.ticket = ticket;
		this.username = username;
		this.jsonResultDate = jsonResultDate;
		this.jsonResults = jsonResults;
	}

	/**
	 * @return
	 */
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ID", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	/**
	 * @param id
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return
	 */
	@NotNull
	@Column(name = "TICKET", nullable = false)
	public String getTicket() {
		return this.ticket;
	}

	/**
	 * @param ticket
	 */
	public void setTicket(String ticket) {
		this.ticket = ticket;
	}

	/**
	 * @return
	 */
	@NotNull
	@Column(name = "USERNAME", nullable = false, length = 50)
	public String getUsername() {
		return this.username;
	}

	/**
	 * @param username
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return
	 */
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "JSON_RESULT_DATE", nullable = false, length = 23)
	public Date getJsonResultDate() {
		return this.jsonResultDate;
	}

	/**
	 * @param jsonResultDate
	 */
	public void setJsonResultDate(Date jsonResultDate) {
		this.jsonResultDate = jsonResultDate;
	}

	/**
	 * @return
	 */
	@Column(name = "JSON_RESULTS")
	public Clob getJsonResults() {
		return this.jsonResults;
	}

	/**
	 * @param jsonResults
	 */
	public void setJsonResults(Clob jsonResults) {
		this.jsonResults = jsonResults;
	}

}
